import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "@/views/layout/Layout.vue";
import Login from "@/views/login/Login.vue";
import Home from "@/views/home/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    // 重定向 访问项目时自动进入登录页
     redirect: "/login",
  },
  {
     path: "/login",
     component: Login,
  },
  {
    path: "/layout",
    // 重定向 到第一个页面 home ,
    redirect: "/home",
    component: Layout,
    children: [
      {
        path: "/home",
        component: Home,
      }
    ]
  }
];

const router = new VueRouter({
  routes,
});

export default router;